from sortedcontainers import SortedDict

# 创建一个红黑树对象
rb_tree = SortedDict()

# 插入元素
rb_tree[3] = 'three'
rb_tree[1] = 'one'
rb_tree[4] = 'four'
rb_tree[2] = 'two'

# 打印红黑树
print(rb_tree)

# 访问元素
print(rb_tree[1])  # 输出: one

# 删除元素
del rb_tree[3]

# 打印更新后的红黑树
print(rb_tree)
